package com.qkl.user.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.qkl.user.dto.InvitationUserDto;
import com.qkl.user.dto.InvitationUserListDto;
import com.qkl.user.entity.InvitationRelation;
import org.apache.ibatis.annotations.Param;

import com.baomidou.mybatisplus.core.conditions.Wrapper;

import java.util.List;
import java.util.Map;


public interface InvitationRelationMapper extends BaseMapper<InvitationRelation> {
    int countLeftChildren(Long inviterId);
    int countRightChildren(Long userId);
    InvitationRelation findLowestChild(Long inviterId);


    InvitationUserDto InvitationUser(Long inviterId);


    Page<InvitationUserListDto> selectInviteUserPage(
            Page<InvitationUserListDto> page,  // MyBatis-Plus自动用该对象做分页
            @Param("ew") Wrapper<InvitationRelation> queryWrapper // 共用查询条件
    );
    Map<Long, InvitationUserDto> batchSelectInvitationUsers(@Param("userIds") List<Long> userIds);
}
